import sqlite3


class SQLITE:
    def get_hash_list(self):
        """
        拿到数据库中所有的hash块
        :return:
        """
        conn = sqlite3.connect('J:\\WORK\\kik\\hash\\db\\hash.db')
        c = conn.cursor()
        cursor = c.execute("SELECT ID, BLOCK, NAME, TIME FROM (SELECT ID, BLOCK, NAME, TIME from HASH ORDER BY ID DESC limit 0,10000) a ORDER  BY ID")
        arr_hash = []
        for row in cursor:
            arr_hash.append({
                "id": row[0],
                "height": row[1],
                "hash": row[2],
                "time": row[3]
            })
        conn.close()
        return arr_hash